import 'package:flutter/material.dart';

void main() async {
  runApp(SampleApp());
}

class SampleApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Sample App',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('文件列表'),
      ),
      body: Container(
        padding: EdgeInsets.all(16.0),
        child: new ListView(
          children: <Widget>[
            new DataTable(
              columns: <DataColumn>[
                new DataColumn(label: new GestureDetector(
                  onTap: () {
                    print('column file tap');
                  },
                  child: Text('File'),
                )),
                new DataColumn(label: new GestureDetector(
                  onTap: () {
                    print('column start tap');
                  },
                  child: Text('Start'),
                )),
                new DataColumn(label: new GestureDetector(
                  onTap: () {
                    print('column end tap');
                  },
                  child: Text('End'),
                )),
                new DataColumn(label: new GestureDetector(
                  onTap: () {
                    print('column status tap');
                  },
                  child: Text('Status'),
                )),
              ],
              rows: <DataRow>[
                new DataRow(cells: <DataCell>[
                  new DataCell(Text('file 1'), onTap: () {
                    print('cell 1 tap');
                  }),
                  new DataCell(Text('2019-03-26 11:00:00'), onTap: () {
                    print('cell 2 tap');
                  }),
                  new DataCell(Text('2019-03-26 11:20:00'), onTap: () {
                    print('cell 3 tap');
                  }),
                  new DataCell(Text('END'), onTap: () {
                    print('cell 4 tap');
                  }),
                ]),
                new DataRow(cells: <DataCell>[
                  new DataCell(Text('file 2'), onTap: () {
                    print('cell 5 tap');
                  }),
                  new DataCell(Text('2019-03-26 11:02:00'), onTap: () {
                    print('cell 6 tap');
                  }),
                  new DataCell(Text('2019-03-26 11:22:00'), onTap: () {
                    print('cell 7 tap');
                  }),
                  new DataCell(Text('WIP'), onTap: () {
                    print('cell 8 tap');
                  }),
                ]),
              ],
            )
          ],
        ),
      ),
    );
  }
}
